# 作者：SP
# 开发时间：2025/3/9 15:47
import unittest
from survey import AnoymousSurvey

class TestSurvey(unittest.TestCase):
    '''测试类'''
    def setUp(self):
        '''创建一个调查对象和一组答案，供使用的测试方法使用'''
        my_question = 'What language did you first learn to speak?'
        self.my_survey = AnoymousSurvey(my_question)
        self.responses = ['English','Spanish','Mandarin']
    def test_store_single_response(self):
        '测试单个答案会被妥当的存储'
        self.my_survey.store_question(self.responses[0])
        self.assertIn(self.responses[0],self.my_survey.response)
    def test_store_some_response(self):
        '测试多个答案会被妥当的存储'
        for response in self.responses:
            self.my_survey.store_question(response)
            self.assertIn(response,self.my_survey.response)
if __name__ == '__main__':
    unittest.main()